#!/bin/sh

arxiv() {
  if [ "$2" ]; then
    id=`basename ${1}`
    dir="${HOME}/Downloads/arxiv"

    [ -d "${dir}" ] || mkdir -p ${dir}
    http --download "https://arxiv.org/pdf/${id}" > ${dir}/${2}_${id}.pdf
  else
    echo "$0: Expected two arguments. ie. url, name"
  fi

}
